/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
* ProgCurveRTPanel.java
*
* Created on January 19, 2008, 5:06 PM
 */
package gui.genomemap.popup;

import gui.genomemap.view.View;

import javax.swing.JPopupMenu;

/**
 *
 * @author  stewari1
 */
public class ProgCurveRTPanel extends javax.swing.JPanel {

    /** Field description */
    private static final String RT_PANEL = "rt_panel";

    /** Field description */
    private View view = null;


    // Variables declaration - do not modify//GEN-BEGIN:variables

    /** Field description */
    private javax.swing.JCheckBox processLog_JCheckBox;

    /** Field description */
    private javax.swing.JCheckBox progCurve_JCheckBox;


    // End of variables declaration//GEN-END:variables

    /** Creates new form ProgCurveRTPanel */
    private ProgCurveRTPanel() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */


    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        processLog_JCheckBox = new javax.swing.JCheckBox();
        progCurve_JCheckBox  = new javax.swing.JCheckBox();

        setBorder(javax.swing.BorderFactory.createTitledBorder("Runtime Control"));
        processLog_JCheckBox.setText("Dynamic Process Log");
        progCurve_JCheckBox.setText("Dynamic Progress Curve");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);

        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                layout.createSequentialGroup().addContainerGap().addGroup(
                    layout.createParallelGroup(
                        javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                        processLog_JCheckBox).addComponent(progCurve_JCheckBox)).addContainerGap(
                            59, Short.MAX_VALUE)));
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                layout.createSequentialGroup().addComponent(processLog_JCheckBox).addPreferredGap(
                    javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(
                    progCurve_JCheckBox).addContainerGap(78, Short.MAX_VALUE)));

    }    // </editor-fold>//GEN-END:initComponents

    public static JPopupMenu createPopup(View view) {

        JPopupMenu popup                        = new JPopupMenu();
        final ProgCurveRTPanel progCurveRTPanel = new ProgCurveRTPanel();

        progCurveRTPanel.setView(view);
        popup.add(progCurveRTPanel);
        popup.putClientProperty(ProgCurveRTPanel.RT_PANEL, progCurveRTPanel);
        popup.setBorderPainted(false);

        return popup;
    }

    public boolean isDynProcessLogSelected() {
        return processLog_JCheckBox.isSelected();
    }

    public boolean isDynProgCurveSelected() {
        return progCurve_JCheckBox.isSelected();
    }

    public View getView() {
        return view;
    }

    void setView(View view) {
        this.view = view;
    }
}
